from behave import *

import Utils as Utils
import page_object.DreadDiseaseInsurance.DreadDiseaseProductPage as DreadDiseaseProductPage
import page_object.HomePage as HomePage


@Step("保费按20年交，保障终身，0岁{gender}宝宝投保保费为{amount}元/年")
def step_impl(context, gender, amount):
    if gender == '男':
        gender_input = 'male'
    elif gender == '女':
        gender_input = 'female'
    else:
        gender_input = 'wrong'

    DreadDiseaseProductPage.input_textbox(context).send_keys(gender_input)


@step("投保人为{customer}选择了该保险产品时")
def step_impl(context, customer):
    HomePage.submit_button(context).click()


@step("客户可知悉需要为其缴纳{total_amount}元每年投保费用")
def step_impl(context, total_amount):
    Utils.assert_with(context, total_amount)


@step("客户应获得提示输入错误{err_msg}")
def step_impl(context, err_msg):
    Utils.assert_with(context, err_msg)
